package com.thb.message.controller;

import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONObject;
import com.thb.logs.utils.LogUtils;
import com.thb.message.service.IMessageService;
import com.thb.user.model.UserCode;
import com.thb.utils.DateUtils;
import com.thb.utils.ResponseTool;

@Controller
public class MessageController extends BaseController {
private static final Logger logger = LogUtils.getBusinessLog();
	
	@Autowired
	private IMessageService messageService;
	
	@RequestMapping(value = "/message/findList" , method = RequestMethod.POST)
	@ResponseBody
	public Object findList(HttpServletRequest request){
		String json = request.getParameter("args");
		String sid = request.getParameter("sid");
		logger.info(String.format("args is: %s,sid is : %s", json,sid));
		JSONObject jo = JSONObject.parseObject(json);
		UserCode user = getSessionUser(sid);
		String lastDate = jo.getString("lastDate");
		Date date = null;
		
		if(lastDate != null && !"".equals(lastDate)){
			date = DateUtils.formatToDate(lastDate, DateUtils.LONG_SIMPLE_DATE);
		}
		
//		List<JSONObject> jList = messageService.findByTime(date,user.getUserId());
		
		return ResponseTool.returns();
	}

}
